package com.qbccn.bbs.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qbccn.bbs.domain.BbsArticleClass;
import com.qbccn.bbs.mapper.BbsArticleClassMapper;
import com.qbccn.bbs.service.AdminService;
import com.qbccn.bbs.vo.TableResultVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author linke
 * @date 2020/8/1 16:52
 * @description
 */
@Service
public class AdminServiceImpl implements AdminService {

  @Autowired
  private BbsArticleClassMapper bbsArticleClassMapper;

  @Override
  public TableResultVo getArticleClass(Integer page, Integer size) {
    if (page == null) {
      page = 1;
    }
    if (size == null) {
      size = 10;
    }
    Page pages = PageHelper.startPage(page, size);
    List<BbsArticleClass> classes=bbsArticleClassMapper.getByPage();
    return new TableResultVo(0, pages.getTotal(),classes);
  }
}
